package com.wgchao.authodemo.userInterface.facade;

import com.wgchao.authodemo.application.mapstruct.dto.AgencyDTO;
import com.wgchao.authodemo.application.mapstruct.mapper.vtod.AgencySaveVDMapper;
import com.wgchao.authodemo.application.mapstruct.mapper.vtod.AgencyVDMapper;
import com.wgchao.authodemo.application.service.base.AgencyService;
import com.wgchao.authodemo.userInterface.vo.agency.AgencySaveVO;
import com.wgchao.authodemo.userInterface.vo.agency.AgencyVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName: AgencyFacade
 * @author: wgchao
 * @createTime: 2019/12/11 9:28 AM
 * @Description: TODO
 */
@RestController
@RequestMapping("/sys/base/agency")
@Api(tags = "机构信息管理")
public class AgencyFacade {
    @Autowired
    private AgencyService agencyService;
    @Autowired
    private AgencySaveVDMapper agencySaveVDMapper;
    @Autowired
    private AgencyVDMapper agencyVDMapper;

    @PostMapping("/save")
    public AgencyVO save(@RequestBody AgencySaveVO agencySaveVO){
        AgencyDTO agencyDTO = agencyService.save(agencySaveVDMapper.toDTO(agencySaveVO));
        return agencyVDMapper.toVO(agencyDTO);
    }

}
